import { getUserDepID, getCompanyID, getUserID } from '@/utils';

/** 资产清单Manage数据范围权限判断 */
export const AssetListManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetController/assetCompanyID']) {
    return {
      assetCompanyID: getCompanyID(),
      params: 'assetCompanyID',
    };
  } else if (curRes?.['/assetController/assetDepartmentID']) {
    return {
      assetDepartmentID: getUserDepID(),
      params: 'assetDepartmentID',
    };
  } else if (curRes?.['/assetController/userID']) {
    return {
      userID: getUserID(),
      params: 'userID',
    };
  } else {
    return {};
  }
};

export const AssetMaterialManage = (curRes: Record<string, any>) => {
  // if (curRes?.['/assetMaterial/createCompanyID']) {
  //   return {
  //     createCompanyID: getCompanyID(),
  //     params: 'createCompanyID',
  //   };
  // } else {
  //   return {};
  // }

  if (curRes?.['/assetMaterial/assetCompanyID']) {
    return {
      assetCompanyID: getCompanyID(),
      params: 'assetCompanyID',
    };
  } else if (curRes?.['/assetMaterial/assetDepartmentID']) {
    return {
      assetDepartmentID: getUserDepID(),
      params: 'assetDepartmentID',
    };
  } else if (curRes?.['/assetMaterial/asseterID']) {
    return {
      asseterID: getUserID(),
      params: 'asseterID',
    };
  } else {
    return {};
  }
};

/**
 * 仓库权限管理
 * @param curRes
 * @returns
 */
export const getManageTabSwitch = (curRes: Record<string, any>) => {
  if (curRes?.['/assetStore/createCompanyID']) {
    return {
      createCompanyID: getCompanyID(),
      params: 'createCompanyID',
    };
  } else {
    return {
      storeCompanyID: getCompanyID(),
      params: 'storeCompanyID',
    };
  }
};
